script_enemy_main{

let shot=0;
let angle=rand_int(0,1);
let oldangle=0;
let count=0;
let type=GetArgument;

let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

let SEshots5=("\script\SoundEffects\shots5.wav");

@Initialize{
	LoadSE("\script\SoundEffects\shots5.wav");

	SetScore(100);
	SetLife(1);
}
	
@MainLoop{

if(time==0){
	shot=(Obj_Create(OBJ_SHOT));
	Obj_SetPosition(shot,GetX,GetY);
	Obj_SetAngle(shot,90);
	Obj_SetSpeed(shot,3);
	ObjShot_SetGraphic(shot,11);
}

if(time%3==0){
let shotx=0;
	if(type==1){
		if(time%9==0){ angle+=1; }
	}
	if(type==2){
		if(count>0){ angle=rand_int(0,1); }
		if(oldangle!=angle){ oldangle=angle; count=0; }
		else{ count++; }
		if(count>=3 && angle==0){ angle=1; count=0; }
		if(count>=3 && angle==1){ angle=0; count=0; }
	}
	CreateShotA(shotx,Obj_GetX(shot),Obj_GetY(shot),5);
	if((angle*180)%360==0){
		SetShotDataA(shotx,0,0,angle*180,0,0,0,1);
		SetShotDataA(shotx,90,0,angle*180,0,0.01,1.2,1);
	}
	if((angle*180)%360!=0){
		SetShotDataA(shotx,0,0,angle*180,0,0,0,8);
		SetShotDataA(shotx,90,0,angle*180,0,0.01,1.2,8);
	}
	FireShot(shotx);
if(time%6==0){ PlaySE(SEshots5); }
}

if(Obj_GetY(shot)>maxy+32){ Obj_Delete(shot); VanishEnemy; }

time++;
frame++;
}

@DrawLoop{
}

@Finalize{
}

}